import { getQuestionStatListApi } from "@/apis/stat"
import { useRequest } from "ahooks"
import { useEffect } from "react"
import { useParams } from "react-router-dom"




const useGetStatList = () => {
  const {id=''} = useParams()
   
  const {data,loading,run} = useRequest(async()=>{
     const res = await getQuestionStatListApi(id, {page:1,pageSize:10})
     return res 
  },{
    manual:true,
  })

  useEffect(()=>{
    if(id){
       run()
    }
  },[id,run])

  return {data,loading}
}

export default useGetStatList